package com.dh.edu.controller;

import com.dh.edu.api.IndexApi;
import com.dh.edu.rule.RibbonParaContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * 服务
 *
 * @Date Created in 2022/8/16 14:10
 */
@RestController
public class HelloController {
    @Autowired
    private IndexApi indexApi;

    @GetMapping("/hello")
    public Map<String, Object> hello(HttpServletRequest request) {
        Map<String, String> param = new HashMap<>();
        param.put("userId", request.getHeader("userId"));
        RibbonParaContext.set(param);
        return indexApi.index();
    }
}
